package com.epam.chenjo.ms.employeeservice.dao.impl;


import java.util.Map;

import org.springframework.stereotype.Component;
//import org.junit.Test;
import org.yaml.snakeyaml.Yaml;

import com.epam.chenjo.ms.employeeservice.dao.EmployeeDao;
import com.epam.chenjo.ms.employeeservice.model.EmployeeDetails;

@Component("d")
public class DummyEmployeeDao implements EmployeeDao {

	@Override
	public EmployeeDetails findEmployeeDetails(String empId) {
		Yaml y = new Yaml();
		@SuppressWarnings("unchecked")
		Map<String, EmployeeDetails> map = (Map<String, EmployeeDetails>) y
				.load(DummyEmployeeDao.class.getResourceAsStream("/employee.yml"));
		if (map.keySet().contains(empId)) {
			return map.get(empId);
		}

		return new EmployeeDetails();
	}
}
